<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css"> 
        html{height:100%} 
        body{height:100%;margin:0px;padding:0px} 
        #container{height:100%} 
    </style> 
    <script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=eIxOKEnFpKxciD8FDVzLGGweNSnCX8hp"></script>
    <!-- <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&&type=webgl&ak=eIxOKEnFpKxciD8FDVzLGGweNSnCX8hp"></script> -->
</head>
<body>
    <div id="container"></div>
    <script type="text/javascript">
        // var map = new BMapGL.Map("container");
         var map = new BMap.Map("container");
        var point = new BMap.Point(116.331398,39.897445);
        map.centerAndZoom(point,12);
        map.enableScrollWheelZoom(true);
        var geolocation = new BMap.Geolocation();
        geolocation.getCurrentPosition(function(r){
            if(this.getStatus() == BMAP_STATUS_SUCCESS){
                ///var mk = new BMap.Marker(r.point);
                 console.log(r);
                 var point = new BMap.Point(r.point.lng,r.point.lat);
                    map.centerAndZoom(point,12);
                    var marker = new BMap.Marker(point);
                    map.addOverlay(marker);
                // map.addOverlay(mk);
                // map.panTo(r.point);
                // alert('您的位置：'+r.point.lng+','+r.point.lat);
            }
            else {
                alert('failed'+this.getStatus());
            }        
        },{enableHighAccuracy: true})
        // var map = new BMapGL.Map("container");
        // // 创建地图实例 
        // var point = new BMapGL.Point(116.404, 39.915);
        // // 创建点坐标 
        // map.centerAndZoom(point, 12);
        // // 初始化地图，设置中心点坐标和地图级别 
        </script> 
</body>
</html>